home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / daten / quickfile / docs / qf_arexx.doc next >
Text File  |  1995-06-27  |  17KB  |  742 lines

  1.  
  2. =============== QuickFile ARexx Command interface ================
  3.  
  4. QuickFile v3.16 24 June 1995   Copyright Alan Wigginton
  5.  
  6. QuickFile accepts ARexx commands from macros (ARexx scripts invoked from
  7. within QuickFile) and from external scripts which may be run from another
  8. application or from the shell or workbench.
  9.  
  10. QuickFile's ARexx port is named QUICKFILE.01 for the first copy of
  11. QuickFile running, QUICKFILE.02 for the next and so on. QuickFile can
  12. open multiple windows so this should not be a problem.
  13.  
  14. Not all QuickFile functions can be executed via an ARexx command. If you
  15. would like to see some other commands added, let me know and I will see
  16. what I can do.
  17.  
  18. QuickFile expects commands to consist of a command name followed by a
  19. series of parameters separated by spaces. Parameters that contain spaces
  20. must be enclosed in quotes, therefore two sets of quotes are required in
  21. ARexx code as ARexx will remove the first set when it parses the command.
  22.  
  23. For example, to pass the following command to QuickFile
  24.  
  25.       ReqMsg 'This is a demo message'
  26.  
  27.   the ARexx code required is
  28.  
  29.       "ReqMsg 'This is a demo message'"
  30.  
  31. Both ARexx and QuickFile will accept either double or single quotes.
  32.  
  33. You should also include quotes around values included from variables if
  34. the variable value could contain spaces. For example:
  35.  
  36.     pull filename
  37.     address quickfile.01 "openfile '"filename"'"
  38.  
  39. If filename was entered as "My file" this would result in the following
  40. being (correctly) passed to quickfile:
  41.  
  42.     openfile 'My file'
  43.  
  44. If the single quotes had been omitted this would have caused an error. The
  45. easiest way to check the string being passed is to display it using say.
  46. This will usually make things clear.
  47.  
  48. QuickFile will process commands regardless of case and any ARex variables
  49. it creates will be upper case. Case is preserved in field values.
  50.  
  51. Confusion with case is a common problem with ARexx. ARexx always
  52. converts any tokens to upper case unless they are in quotes. A common
  53. trap is that the PULL and ARG statements translate to upper case as they
  54. are equivalent to PARSE UPPER PULL and PARSE UPPER ARG. To preserve case
  55. use PARSE PULL and PARSE ARG instead.
  56.  
  57. Return codes
  58.  
  59. The return codes from QuickFile have the following general meanings. See
  60. the command descriptions for details
  61.  
  62.     5    Warning or object not found.
  63.    10    Command failed
  64.    12    Unknown command
  65.    15    System error - usually out of memory
  66.    20    Syntax error
  67.  
  68. Command notation convention
  69.  
  70.     Command names use Initial Capitals eg GetRec
  71.     Values in square brackets [ ] are optional
  72.     You must include one of the values in braces {A | D}
  73.     Repeated values are indicated by ellipsis ...
  74.     Keywords are shown in UPPER CASE
  75.     Lower case words represent values you provide
  76.  
  77. ============= AddSearch =============
  78.  
  79. AddSearch {AND | OR} fieldname operator value1 [value2]
  80.  
  81. Adds a new search criteria to the existing criteria. Use the NewSearch
  82. command to replace any existing criteria and use DoSearch to start the
  83. search.
  84.  
  85. AND | OR    Determines how multiple criteria are to be handled. See
  86.         QuickFile docs for full details.
  87.  
  88. See the NewSearch command for details of the remaining parameters.
  89.  
  90. Results
  91.     None
  92.  
  93. Return codes
  94.     10    Unknown field or operator
  95.     20    Insufficient parameters or first parameter is not AND or OR
  96.  
  97. Example
  98.     /* select records where surname is brown or smith */
  99.     "newsearch surname equal brown"
  100.     "addsearch or surname equal smith"
  101.     "dosearch"
  102.  
  103. ============= CloseWin ===============
  104.  
  105. CloseWin
  106.  
  107. Closes the current window and file. You cannot close the last window with
  108. an ARexx command. The first window in QuickFiles internal list becomes the
  109. current window,
  110.  
  111. Results
  112.     None
  113.  
  114. Return codes
  115.     5    You tried to close the last window.
  116.  
  117. Example
  118.     "closewin"
  119.  
  120. ============== ClrRec ====================
  121.  
  122. ClrRec
  123.  
  124. Clears all fields in the current record. Use this to clear all fields
  125. before setting up the values for a new record
  126.  
  127. Results
  128.     None
  129.  
  130. Return codes
  131.     None
  132.  
  133. Example
  134.     "ClrRec"
  135.     "putfield surname Brown"
  136.     "putfield firstname John"
  137.     "putfield address '23 George Street'"
  138.     "insrec"
  139.  
  140. ============== DelRec ================
  141.  
  142. DelRec
  143.  
  144. Deletes the current record. The next record becomes the new current
  145. record.
  146.  
  147. Results
  148.     None
  149.  
  150. Return codes
  151.     5    There are no records in the file.
  152.  
  153. Example
  154.     "getfield expirydate"
  155.     if result < today then
  156.     "delrec"
  157.  
  158. ============== DoSearch ============
  159.  
  160. DoSearch
  161.  
  162. Searches through the data base and selects records matching the search
  163. criteria. The criteria are established using the NewSearch and AddSearch
  164. commands.
  165.  
  166. It places the matching records in an index named SELECTED. It does not
  167. change the current index.
  168.  
  169. Results
  170.     RESULT contains the number of matching
  171.  
  172. Return codes
  173.     None
  174.  
  175. Example
  176.     "newsearch surname equal brown"
  177.     "addsearch or surname equal smith"
  178.     "dosearch"
  179.     "setindex selected"
  180.  
  181. ================ FreeIndex ==============
  182.  
  183. FreeIndex
  184.  
  185. Discards the current index and frees the storage used. Only temporary
  186. indexes, ie those named SORTED and SELECTED, can be freed.
  187.  
  188. Results
  189.     None
  190.  
  191. Return codes
  192.     10    Not a temporary index
  193.  
  194. Example
  195.     "setindex selected"
  196.     "freeindex"
  197.  
  198. ================ FreeView =================
  199.  
  200. FreeView
  201.  
  202. Discards the current view from memory and frees associated storage. The
  203. first view in the loaded list becomes the current view. The display is
  204. redrawn. You must keep at least one view. It does not affect the disk
  205. file containing the view.
  206.  
  207. Result
  208.     None
  209.  
  210. Return codes
  211.     5    You tried to free the last view
  212.  
  213. Example
  214.     "setview mylist.view"
  215.     "freeview"
  216.  
  217. ================ GetField =================
  218.  
  219. GetField field
  220.  
  221. Returns value of field from the current record
  222.  
  223. Result
  224.     Field value is placed in RESULT.
  225.  
  226. Return Codes
  227.     10    Field requested does not exist
  228.     20    Field name omitted
  229.  
  230. Example
  231.     "goto Smith"
  232.     "getfield surname"
  233.     say "Found name" result   * Displays==> Found name Smith */
  234.  
  235. ============= GetRec =============
  236.  
  237. GetRrec stem
  238.  
  239. Returns values for all fields from the current record in compound
  240. variables in the form of stem.fieldname where fieldname is the field name
  241. from the file definition (not always the title in the view).
  242.  
  243. You cannot use this if your field names contain spaces; use GETFIELD
  244. instead.
  245.  
  246. Results
  247.     stem.fieldname variables updated.
  248.  
  249. Return codes
  250.     20    Syntax error. stem not provided.
  251.  
  252. Example
  253.     "next"
  254.     "getrec val"
  255.     say val.firstname val.surname
  256.  
  257. =========== GoTo ===========
  258.  
  259. GoTo value1 [value2...]
  260.  
  261. Sets the current position to the first record with the current key
  262. matching the specified values. Value1 is the value for index field 1 and
  263. Value2 is the value for index field 2 etc.
  264.  
  265. QuickFile does not tell you if the requested record was not found. It will
  266. happily position on the next record. You must compare the record with the
  267. requested key values to check if they were found.
  268.  
  269. Result
  270.     None
  271.  
  272. Return Codes
  273.     5    End of file encountered. Requested key higher than any record.
  274.    10    More values specified than index fields
  275.  
  276. Example
  277.     "goto Brown John"
  278.     "getrec val"
  279.     if val.surname ~= "Brown" | val.firstname ~= "John" then
  280.     say "Record not found"
  281.  
  282. ============ InsRec ================
  283.  
  284. InsRrec
  285.  
  286. Adds a new record to the file. You use PUTFIELD to set the field values
  287. before issuing INSREC. Any fields not updated with PUTFIELD will retain
  288. the values from the previous record. Use CLRREC to clear all values
  289. before setting up your new record.
  290.  
  291. Results
  292.     None
  293.  
  294. Return codes
  295.     10    Error occurred. Probably duplicate key.
  296.  
  297. Examaple
  298.     "ClrRec"        /* omit this to use values from previous record */
  299.     "putfield surname Brown"
  300.     "putfield firstname John"
  301.     "putfield address '23 George Street'"
  302.     "insrec"
  303.  
  304. =================== LoadView ==============
  305.  
  306. LoadView path
  307.  
  308. Loads the named view. The full name including extension must be specified.
  309. This does not change the display. Use the SetView command to change the
  310. current view.
  311.  
  312. Result
  313.     None
  314.  
  315. Return codes
  316.     10    File not found
  317.     10    path name not specified
  318.  
  319. Example
  320.     "loadview df0:QuickFile/Example1/Product.view"
  321.  
  322. =================== NewSearch =============
  323.  
  324. NewSearch fieldname operator value1 [value2]
  325.  
  326. Replaces any existing search criteria with a new one. Use the AddSearch
  327. command to add additional criteria, if required, and use  the DoSearch
  328. command to start the actual search.
  329.  
  330. operator    The search operator. One of the following:
  331.         like
  332.         equal
  333.         between
  334.         notlike
  335.         notequal
  336.         sounds
  337.  
  338. value1        The value to be used in the search
  339.  
  340. value2        The second value required for the between operator. Can also
  341.         be used for others. See QuickFile docs for more details.
  342.  
  343. Results
  344.     None
  345.  
  346. Return codes
  347.     10    Unknown field or operator
  348.     20    Insufficient parameters
  349.  
  350. Example
  351.  /* find all current memberships that expire in March */
  352.     "newsearch status equal current"
  353.     "addsearch and 'expiry date' between 01-mar-95 31-mar-95"
  354.     "dosearch"
  355.  
  356. ================== Next ================
  357.  
  358. Next [n]
  359.  
  360. Moves n records forward or backward through the file. If n is omitted 1 is
  361. assumed. If the resulting position is outside the range of the file, the
  362. position will be the first or last record. n can be positive or negative.
  363.  
  364. Result
  365.     None.
  366.  
  367. Return codes
  368.     5    No more records. Positioned at first or last record
  369.  
  370. Example
  371.     "Next -9999"    /* move to start of file */
  372.     "Next"          /* move to second record */
  373.  
  374. ============ NumRecs ===============
  375.  
  376. NumRecs
  377.  
  378. Returns number of records in the current index. If 'Selected' is the
  379. current index, this will be the number of selected records.
  380.  
  381. Result
  382.     Number of records in RESULT
  383.  
  384. Return codes
  385.     10    No file open
  386.  
  387. Example
  388.     "SetIndex name"
  389.     say result            /* ==> 253    */
  390.     "SetIndex selected"
  391.     "NumRecs"
  392.     say result            /* ==> 16 */
  393.  
  394. ============ OpenFile ===============
  395.  
  396. OpenFile pathname
  397.  
  398. Opens a new file in the current window. Closes the existing file, if any.
  399. To open an additional file, issue the OPENWINDOW command first to obtain a
  400. new window.
  401.  
  402. Result
  403.     None
  404.  
  405. Return codes
  406.     10    The file could not be opened. NB Any previous file will have been
  407.     closed.
  408.     20    pathname not specified
  409.  
  410. Example
  411.     "openfile 'ram disk:Membership'"  /* care with spaces in path names */
  412.  
  413. ================== OpenWin ===============
  414.  
  415. OpenWin
  416.  
  417. Opens a new window which becomes the current window. It will have no open
  418. file. Until a file is opened, the only commands that can be issued are
  419. OpenFile, CloseWin.
  420.  
  421. Result
  422.     None
  423.  
  424. Return Codes
  425.     10    The window could not be opened
  426.  
  427. Example
  428.     pull filename
  429.     "openwin"
  430.     "openfile '"filename"'"  /* quotes in case filename contains spaces */
  431.  
  432. =========== PutField ==============
  433.  
  434. PutField field value
  435.  
  436. Sets the contents of field for the current record to value. The change
  437. will not take effect until you issue the UPDREC command. value must be
  438. consistent with the field's type.
  439.  
  440. Result
  441.     None
  442.  
  443. Return codes
  444.     5    The value is inconsistent with the field type. The field is not
  445.     updated
  446.    10    The field does not exist
  447.    20    Either field or value were omitted
  448.  
  449. Example
  450.     "next"
  451.     newdate = "31-Mar-1996"
  452.     "putfield 'expiry date'" newdate
  453.     "updrec"
  454.  
  455. =============== Query =================
  456.  
  457. Query {FIELD | INDEX} type stem [name]
  458.  
  459. Obtains details about the current file.
  460.  
  461. stem    A stem variable to receive the details
  462.  
  463. name    An optional name of an object to be queried. If omitted, a summary
  464.     of all objects of the requested type are returned.
  465.  
  466. Results
  467.  
  468.   FIELD without name
  469.     Returns the number of fields in stem.0 and the field names in
  470.     stem.1 to stem.n where n is the number of fields.
  471.  
  472.   FIELD with name
  473.     Returns field type in stem.type and the maximum length in
  474.     stem.length. Name is a field name
  475.  
  476.   INDEX without name
  477.     Returns the number of indexes in stem.0 and the index names
  478.     in stem.1 to stem.n
  479.  
  480.   INDEX with name
  481.     Returns the number of index fields in stem.0 in the field names in
  482.     stem.1 to stem.n. Name is an index name.
  483.  
  484. Return codes
  485.     10    Requested name does not exist
  486.     15    Syntax error. Either a required field was omitted or type was not
  487.     FIELD or INDEX.
  488.  
  489. Example
  490.     "query field fld"
  491.     do i = 1 to fld.0    /* displays all field names */
  492.     say fld.i
  493.     end
  494.  
  495. ============== Refresh =============
  496.  
  497. Refresh
  498.  
  499. Redraws the screen display. This should not be required in a macro, but
  500. will be required if you want to update the display to reflect changes
  501. made from an external script.
  502.  
  503. Result
  504.     None
  505.  
  506. Return codes
  507.     None
  508.  
  509. Example
  510.     "refresh"
  511.  
  512. ============== Report ===============
  513.  
  514. Report count [target [title]]
  515.  
  516. Produces the report defined for the current view. Writes 'count' records
  517. starting at the current record. The parameters are positional so 'title'
  518. cannot be specified without 'target'.
  519.  
  520. count    Number of records to process. Specify -1 for all.
  521.  
  522. target    Specify 'printer' to write report to the printer, otherwise the
  523.     report is written to the screen.
  524.  
  525. title    Up to 50 characters to be used instead of the title defined for
  526.     the report. Don't forget the extra quotes.
  527.  
  528. Note that the report definition is not changed.
  529.  
  530. Result
  531.     None
  532.  
  533. Return codes
  534.     10    No report has been defined for the current view.
  535.     15    Could not allocate memory.
  536.  
  537. Example
  538.     "report -1 printer 'Report Title over-ride'"  /* note quotes */
  539.  
  540.     "report 10 screen"
  541.  
  542. ============== ReqChoice ============
  543.  
  544. ReqChoice line1 [line2]
  545.  
  546. Displays a requester that displays two lines of text with OK and CANCEL
  547. buttons. Don't forget the extra set of quotes.
  548.  
  549. Result
  550.     None
  551.  
  552. Return codes
  553.     0    User chose OK.
  554.     5    User chose CANCEL.
  555.    20    No message text specified
  556.  
  557. Example
  558.     "reqchoice 'Delete requested' 'Are you sure'"
  559.     if rc = 0 then
  560.     "delrec"
  561.     else
  562.     say "Delete cancelled"
  563.  
  564. ============== ReqMsg =============
  565.  
  566. ReqMsg message
  567.  
  568. Displays the message in a requester. The message must be enclosed in
  569. quotes if it is more than one word.
  570.  
  571. Result
  572.     None
  573.  
  574. Return codes
  575.     20        No message specified
  576.  
  577. Example
  578.     "ReqMsg 'This message from ARexx script'"
  579.  
  580. ============== ReqString ============
  581.  
  582. ReqString default [title]
  583.  
  584. Displays a requester with a string gadget to obtain input from the
  585. keyboard.
  586.  
  587. default     The default value to be placed in the string gadget. Specify
  588.         '' if no default
  589.  
  590. title        The title to be displayed in the requester window.
  591.  
  592. Result
  593.     RESULT will contain the users input string
  594.  
  595. Return codes
  596.      0    User pressed OK
  597.      5    User pressed CANCEL
  598.     20    No message specified
  599.  
  600. Example
  601.     "reqstring '' 'Please enter your name'"
  602.     if rc = 0 then
  603.     name =    result
  604.  
  605. ============== SaveFile ==============
  606.  
  607. SaveFile
  608.  
  609. Writes any updates to disk, if any changes have been made.
  610.  
  611. Result
  612.     None
  613.  
  614. Return codes
  615.     None
  616.  
  617. Example
  618.     "savefile"
  619.  
  620. ============== SetFile ===============
  621.  
  622. SetFile [filename]
  623.  
  624. Selects window containing filename as the current window or returns
  625. current file name if 'filename' is not specified.
  626.  
  627. The file must have been opened previously. 'Filename' is the file name
  628. part only, not including disk and directory names.
  629.  
  630. Results
  631.     Current file name if issued without filename, otherwise none.
  632.  
  633. Return code
  634.     5  Unknown file name
  635.  
  636. Example
  637.     "setfile"
  638.     say result
  639.  
  640.     "setfile Images"
  641.  
  642. ============= SetIndex =====================
  643.  
  644. SetIndex [indexname]
  645.  
  646. Makes indexname the current index. Specify a name as SORTED to use the
  647. last sort sequence and SELECTED to use the last selection.
  648.  
  649. Returns name of the current index if issued without 'indexname'.
  650.  
  651. Results
  652.     Name of current index if issued without name, otherwise none.
  653.  
  654. Return codes
  655.     5  Could not find index
  656.  
  657. Example
  658.     "setindex sorted"
  659.  
  660. ==================== SetView =================
  661.  
  662. SetView [viewname]
  663.  
  664. Makes the named view the current view and redraws the display using the
  665. new view. The viewname must include the extension, if any.
  666.  
  667. If 'viewname' is not specified, returns the name of the current view.
  668.  
  669. Warning: If used from a macro, this may cause the window to be redrawn
  670. several times in quick succession after the macro completes. This happens
  671. because QuickFile does not respond to Intuition's newsize messages while
  672. the macro is running and several may be queued up when the macro
  673. completes. This does not happen if it is used from the shell or another
  674. program.
  675.  
  676. Result
  677.     Name of the current view if issued without 'viewname', otherwise none.
  678.  
  679. Return codes
  680.     5  Could not find view
  681.  
  682. Example
  683.     "setview namelist.view"
  684.  
  685. ==================== Sort ===================
  686.  
  687. Sort field {A | D} [field {A | D} ] ...
  688.  
  689. Creates a new index named SORTED in the specified sequence and makes
  690. 'sorted the current index.
  691.  
  692. field    The field name to sort over
  693.  
  694. order    A for ascending, D for descending
  695.  
  696. Both field and order must be specified for each sort field. You can switch
  697. between indexes, including SORTED and SELECTED using SETINDEX.
  698.  
  699. Result
  700.     None
  701.  
  702. Return codes
  703.     10    One of the sort fields was not known.
  704.     20    Either no parameters specified or there was not an even number
  705.     of parameters
  706.  
  707. Example
  708.     "sort country a surname a firstname a"
  709.  
  710. =========== UpdRec ==============
  711.  
  712. UpdRec
  713.  
  714. Commits an updated record to the file. The update is not necessarily
  715. written back to disk at this point.
  716.  
  717. Results
  718.     None
  719.  
  720. Return codes
  721.     10    Internal error occurred. Possibly a duplicate key occurred
  722.  
  723. Example
  724.     "putfield ExpiryDate 31-Mar-95"
  725.     "updrec"
  726.  
  727. ========= WinToFront ============
  728.  
  729. WinToFront
  730.  
  731. Moves the current window to the front of the display.
  732.  
  733. Results
  734.     None
  735.  
  736. Return codes
  737.     None
  738.  
  739. Example
  740.     "wintofront"
  741.  
  742.